package com.framework;

import java.util.EnumSet;

abstract class ComponentDecorator<T, R> implements Component<T, R> {
    protected final Component<T, R> delegate;
    protected final EnumSet<ComponentFeature> features;
    
    public ComponentDecorator(Component<T, R> delegate, EnumSet<ComponentFeature> features) {
        this.delegate = delegate;
        this.features = features;
    }
    
    public boolean hasFeature(ComponentFeature feature) {
        return features.contains(feature);
    }
    
    @Override
    public String getType() {
        return delegate.getType() + "#" + this.getClass().getSimpleName();
    }
}